All Packages Class Hierarchy This Package Previous Next Index
Class quicktime.qd.QDRect
java.lang.Object
|
+----quicktime.util.QTByteObject
|
+----quicktime.qd.QDRect
- public final class QDRect
- extends QTByteObject
- implements PrimitivesLib, Cloneable
This class corresponds to the Rect and FixedRect Data structures.
It has a current limitation of x and y < 32767 and x+width, y+height < 32767.
The width and height values are the number of pixels that will be seen - thus
if x == 1 and width is 3, the pixels drawn will be pixels at 1, 2, 3.
-
kIsFixedRect
- These constants are used in the fromArray call to indicate
which of the 2 formats the byte array is encoded in.
-
kIsRect
- These constants are used in the fromArray call to indicate
which of the 2 formats the byte array is encoded in.
-
QDRect()
- Constructs a new rectangle, with (0, 0) origin and 0 width and height
-
QDRect(Dimension)
- Constructs a rectangle at (0, 0) and initializes it to the specified width and
height.
-
QDRect(float, float)
- Constructs a rectangle and initializes it with the specified width and
height parameters.
-
QDRect(float, float, float, float)
- Constructs and initializes a rectangle with the specified parameters.
-
QDRect(int, int)
- Constructs a rectangle and initializes it with the specified width and
height parameters.
-
QDRect(int, int, int, int)
- Constructs and initializes a rectangle with the specified parameters.
-
QDRect(Point)
- Constructs a rectangle of 0 width and height and specified origin.
-
QDRect(Point, Dimension)
- Constructs a rectangle and initializes it to a specified point and
dimension.
-
QDRect(Rectangle)
- Constructs a QDRect from a java.awt.Rectangle.
-
add(float, float)
- Adds a point to the QDRect.
-
add(int, int)
- Adds a point to the QDRect.
-
add(Point)
- Adds a point to the QDRect.
-
clone()
- Return a copy of the QDRect
-
copy()
- Returns a copy of the QDRect with the correct return type.
-
equals(Object)
- Checks whether two QDRects are equal.
-
fromArray(byte[], int)
- Creates a QDRect from an array of bytes.
-
getEndianDescriptorFixedRect()
- Returns the EndianDescriptor for FixedRect Rect.
-
getEndianDescriptorRect()
- Returns the EndianDescriptor for QDRect Rect.
-
getFixedRect()
- Returns the bytes for the FixedRect
-
getHeight()
-
Get the height of the QDRect.
-
getHeightF()
-
Get the height of the QDRect.
-
getRect()
- Returns the bytes for the QDRect
-
getWidth()
-
Get the width of the QDRect.
-
getWidthF()
-
Get the width of the QDRect.
-
getX()
-
Get the x location of the rect.
-
getXF()
-
Get the x location of the rect.
-
getY()
-
Get the y location of the rect.
-
getYF()
-
Get the y location of the rect.
-
grow(float, float)
- Grows the QDRect horizontally and vertically.
-
grow(int, int)
- Grows the QDRect horizontally and vertically.
-
hashCode()
- Returns the hashcode for this Rectangle.
-
inside(float, float)
- Checks if the specified point lies inside a QDRect.
-
inside(int, int)
- Checks if the specified point lies inside a QDRect.
-
intersection(QDRect)
- Computes the intersection of two QDRects, returning the
largets rect that encompasses both rects.
-
intersects(QDRect)
- Checks if two QDRects intersect.
-
isDifferentOrigin(QDRect)
- Returns true if the QDRect argument has a different origin.
-
isDifferentSize(QDRect)
- Returns true if the QDRect argument is a different size.
-
isEmpty()
- Determines whether the QDRect is empty.
-
move(float, float)
- Moves the QDRect to x, y.
-
move(int, int)
- Moves the QDRect to x, y.
-
reshape(float, float, float, float)
- Reshapes the QDRect to x, y, width and height.
-
reshape(int, int, int, int)
- Reshapes the QDRect to x, y, width and height.
-
resize(float, float)
- Resizes the QDRect.
-
resize(int, int)
- Resizes the QDRect.
-
setHeight(float)
-
Set the height of the QDRect.
-
setHeight(int)
-
Set the height of the QDRect.
-
setWidth(float)
-
Set the width of the QDRect.
-
setWidth(int)
-
Set the width of the QDRect.
-
setX(float)
-
Set the x location of the rect.
-
setX(int)
-
Set the x location of the rect.
-
setY(float)
-
Set the y location of the rect.
-
setY(int)
-
Set the y location of the rect.
-
toRectangle()
- Returns a java.awt.Rectangle corresponding to the current state.
-
toString()
- Returns the String representation of this QDRect's values.
-
translate(float, float)
- Translates the QDRect deltaX and deltaY.
-
translate(int, int)
- Translates the QDRect deltaX and deltaY.
-
union(QDRect)
- Computes the union of two QDRects, returning the smallest
Rect that is the union of the two QDRects.
kIsRect
public static final int kIsRect
- These constants are used in the fromArray call to indicate
which of the 2 formats the byte array is encoded in.
kIsFixedRect
public static final int kIsFixedRect
- These constants are used in the fromArray call to indicate
which of the 2 formats the byte array is encoded in.
QDRect
public QDRect()
- Constructs a new rectangle, with (0, 0) origin and 0 width and height
QDRect
public QDRect(int x,
int y,
int width,
int height)
- Constructs and initializes a rectangle with the specified parameters.
Int values will be cast to shorts.
- Parameters:
- x - the x coordinate
- y - the y coordinate
- width - the width of the rectangle
- height - the height of the rectangle
QDRect
public QDRect(float x,
float y,
float width,
float height)
- Constructs and initializes a rectangle with the specified parameters.
- Parameters:
- x - the x coordinate
- y - the y coordinate
- width - the width of the rectangle
- height - the height of the rectangle
QDRect
public QDRect(int width,
int height)
- Constructs a rectangle and initializes it with the specified width and
height parameters.
- Parameters:
- width - the width of the rectangle
- height - the height of the rectangle
QDRect
public QDRect(float width,
float height)
- Constructs a rectangle and initializes it with the specified width and
height parameters.
- Parameters:
- width - the width of the rectangle
- height - the height of the rectangle
QDRect
public QDRect(Point origin,
Dimension size)
- Constructs a rectangle and initializes it to a specified point and
dimension.
- Parameters:
- origin - the origin
- size - the size of the rectangle
QDRect
public QDRect(Point origin)
- Constructs a rectangle of 0 width and height and specified origin.
- Parameters:
- origin - the origin
QDRect
public QDRect(Dimension size)
- Constructs a rectangle at (0, 0) and initializes it to the specified width and
height.
- Parameters:
- size - the value of the width and height
QDRect
public QDRect(Rectangle rect)
- Constructs a QDRect from a java.awt.Rectangle.
- Parameters:
- rect - the java.awt.Rectangle
getEndianDescriptorFixedRect
public static final EndianDescriptor getEndianDescriptorFixedRect()
- Returns the EndianDescriptor for FixedRect Rect.
- Returns:
- an EndianDescriptor
getEndianDescriptorRect
public static final EndianDescriptor getEndianDescriptorRect()
- Returns the EndianDescriptor for QDRect Rect.
- Returns:
- an EndianDescriptor
fromArray
public static QDRect fromArray(byte rectBytes[],
int flag)
- Creates a QDRect from an array of bytes. The minimum length of the array
must equate to the requirements of the size of the native structure to
store the result.
- kIsRect, length == 8, top, left, right, bottom of 2 bytes each
- kIsFixedRect, length == 16, left, top, right, bottom of 4 bytes each (fixed format 16.16)
- Parameters:
- rectBytes - the byte array containing the rect values
- flag - flag that describes the format of the byte array
- Returns:
- a QDRect
- Throws: IllegalArgumentException
- if mismatch between minimum length of byte array and format flag
getRect
public byte[] getRect()
- Returns the bytes for the QDRect
getFixedRect
public byte[] getFixedRect()
- Returns the bytes for the FixedRect
getX
public int getX()
- Get the x location of the rect.
- Returns:
- the current x location
getXF
public float getXF()
- Get the x location of the rect.
- Returns:
- the current x location
setX
public void setX(int x)
- Set the x location of the rect.
- Parameters:
- x - the new x location
setX
public void setX(float x)
- Set the x location of the rect.
- Parameters:
- x - the new x location
getY
public int getY()
- Get the y location of the rect.
- Returns:
- the current y location
getYF
public float getYF()
- Get the y location of the rect.
- Returns:
- the current y location
setY
public void setY(int y)
- Set the y location of the rect.
- Parameters:
- y - the new y location
setY
public void setY(float y)
- Set the y location of the rect.
- Parameters:
- y - the new y location
isDifferentSize
public boolean isDifferentSize(QDRect rect)
- Returns true if the QDRect argument is a different size.
isDifferentOrigin
public boolean isDifferentOrigin(QDRect rect)
- Returns true if the QDRect argument has a different origin.
getWidth
public int getWidth()
- Get the width of the QDRect.
- Returns:
- the current width
getWidthF
public float getWidthF()
- Get the width of the QDRect.
- Returns:
- the current width
setWidth
public void setWidth(int width)
- Set the width of the QDRect.
- Parameters:
- width - the new width
setWidth
public void setWidth(float width)
- Set the width of the QDRect.
- Parameters:
- width - the new width
getHeight
public int getHeight()
- Get the height of the QDRect.
- Returns:
- the current height
getHeightF
public float getHeightF()
- Get the height of the QDRect.
- Returns:
- the current height
setHeight
public void setHeight(int height)
- Set the height of the QDRect.
- Parameters:
- height - the new height
setHeight
public void setHeight(float height)
- Set the height of the QDRect.
- Parameters:
- height - the new height
reshape
public void reshape(int x,
int y,
int width,
int height)
- Reshapes the QDRect to x, y, width and height.
reshape
public void reshape(float x,
float y,
float width,
float height)
- Reshapes the QDRect to x, y, width and height.
move
public void move(int x,
int y)
- Moves the QDRect to x, y.
move
public void move(float x,
float y)
- Moves the QDRect to x, y.
translate
public void translate(int deltaX,
int deltaY)
- Translates the QDRect deltaX and deltaY.
translate
public void translate(float deltaX,
float deltaY)
- Translates the QDRect deltaX and deltaY.
resize
public void resize(int width,
int height)
- Resizes the QDRect.
resize
public void resize(float width,
float height)
- Resizes the QDRect.
inside
public boolean inside(int x,
int y)
- Checks if the specified point lies inside a QDRect.
- Parameters:
- x - the x coordinate
- y - the y coordinate
inside
public boolean inside(float x,
float y)
- Checks if the specified point lies inside a QDRect.
- Parameters:
- x - the x coordinate
- y - the y coordinate
intersects
public boolean intersects(QDRect r)
- Checks if two QDRects intersect.
intersection
public QDRect intersection(QDRect r)
- Computes the intersection of two QDRects, returning the
largets rect that encompasses both rects.
- Parameters:
- r - the rect to intersect with
- Returns:
- a QDRect
union
public QDRect union(QDRect r)
- Computes the union of two QDRects, returning the smallest
Rect that is the union of the two QDRects.
- Parameters:
- r - the rect to unify with this
- Returns:
- a rect
add
public void add(int newX,
int newY)
- Adds a point to the QDRect. This results in the smallest
QDRect that contains both the existing rectangle and the new point.
add
public void add(float newX,
float newY)
- Adds a point to the QDRect. This results in the smallest
QDRect that contains both the existing rectangle and the new point.
add
public void add(Point pt)
- Adds a point to the QDRect. This results in the smallest
QDRect that contains both the existing rectangle and the new point.
grow
public void grow(int h,
int v)
- Grows the QDRect horizontally and vertically.
This method modifies the QDRect so that it is
h units larger on both the left and right side,
and v units larger at both the top and bottom.
grow
public void grow(float h,
float v)
- Grows the QDRect horizontally and vertically.
This method modifies the QDRect so that it is
h units larger on both the left and right side,
and v units larger at both the top and bottom.
isEmpty
public boolean isEmpty()
- Determines whether the QDRect is empty.
hashCode
public int hashCode()
- Returns the hashcode for this Rectangle.
- Overrides:
- hashCode in class Object
equals
public boolean equals(Object obj)
- Checks whether two QDRects are equal.
- Overrides:
- equals in class QTByteObject
toString
public String toString()
- Returns the String representation of this QDRect's values.
- Overrides:
- toString in class QTByteObject
clone
public Object clone()
- Return a copy of the QDRect
- Returns:
- a QDRect
- Overrides:
- clone in class Object
copy
public QDRect copy()
- Returns a copy of the QDRect with the correct return type.
- Returns:
- a QDRect
toRectangle
public Rectangle toRectangle()
- Returns a java.awt.Rectangle corresponding to the current state.
- Returns:
- the java.awt.Rectangle
All Packages Class Hierarchy This Package Previous Next Index